package test;

import java.io.File;

public class ta {
	public static void main(String[] args) {
		String title="";
		title=title.replaceAll("[^0-9a-zA-Z-/:_]", "|");
		title=title.replaceAll("\\|{2,}", "|");
		title=title.trim();
		String titles[]=title.split("\\|");
		if(titles.length>0){
			title=titles[titles.length-1].trim();
		}
		if(title.startsWith("|")){
			title=title.substring(1);
		}
		if(title.endsWith("|")){
			title=title.substring(0, title.length()-1);
		}
		while (true) {
			if(title.startsWith("-")||title.startsWith("/")||title.startsWith(":")||title.startsWith("_")){
				title=title.substring(1);
			}
			else{
				break;
			}
		}
		
		while (true) {
			if(title.endsWith("-")||title.endsWith("/")||title.endsWith(":")||title.endsWith("_")){
				title=title.substring(0,title.length()-1);
			}
			else{
				break;
			}
		}
		System.out.println(title);
	}
}
